Skip to content

Add operation log related interfaces#92

Merged
downdawn merged 9 commits intofastapi-practices:masterfrom
wu-clan:add-opera-log
Jun 5, 2023
Merged

Add operation log related interfaces#92
downdawn merged 9 commits intofastapi-practices:masterfrom
wu-clan:add-opera-log

Conversation

@wu-clan
Copy link
Member

@wu-clan wu-clan commented Jun 3, 2023

There is a problem with this middleware that needs to be addressed.

WIP.

@wu-clan
Copy link
Member Author

wu-clan commented Jun 5, 2023

I have tried some efforts, but there seems to be a problem with using request bodies in middleware for Starlette version 0.27.0, see Kludex/starlette#2026 for details.

@wu-clan
Copy link
Member Author

wu-clan commented Jun 5, 2023

I think it is possible to merge this PR ahead of time, provided that the problematic code is commented out and a new PR is opened to fix it after Starlette is updated.

@wu-clan wu-clan requested a review from downdawn June 5, 2023 05:37
@wu-clan
Copy link
Member Author

wu-clan commented Jun 5, 2023

Hi, @downdawn

Any ideas?

@downdawn
Copy link
Collaborator

downdawn commented Jun 5, 2023

No problem.

I suggest keeping the MIDDLEWARE_ACCESS because this middleware has become complex now and there may be some unknown issues.

@downdawn
Copy link
Collaborator

downdawn commented Jun 5, 2023

Some native methods.

user_agent = request.headers.get('User-Agent')
_user_agent = parse(user_agent)
device = _user_agent.get_device()
os = _user_agent.get_os()
browser = _user_agent.get_browser()

@wu-clan
Copy link
Member Author

wu-clan commented Jun 5, 2023

No problem.

I suggest keeping the MIDDLEWARE_ACCESS because this middleware has become complex now and there may be some unknown issues.

I will restore it.

@wu-clan
Copy link
Member Author

wu-clan commented Jun 5, 2023

Some native methods.

user_agent = request.headers.get('User-Agent')
_user_agent = parse(user_agent)
device = _user_agent.get_device()
os = _user_agent.get_os()
browser = _user_agent.get_browser()

No problem at all.

@wu-clan
Copy link
Member Author

wu-clan commented Jun 5, 2023

TBR.

@wu-clan wu-clan requested a review from downdawn June 5, 2023 09:17
@downdawn downdawn merged commit 627208b into fastapi-practices:master Jun 5, 2023
@wu-clan wu-clan deleted the add-opera-log branch June 5, 2023 13:43
chuxijin pushed a commit to chuxijin/fba that referenced this pull request Feb 8, 2026
* Add operation log related interfaces

* Update to native ASGI middleware

* add the opera model class to the __init__.py

* Executable code collation

* Reply to the access middleware

* Using the request extension params in the login log

* Fix the whitelist list

* Fix username resolution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants